<?php

use yii\db\Migration;

class m170624_014606_create_spread_url extends Migration
{
    public function up()
    {
        $tableOptions = null;
        if ($this->db->driverName === 'mysql') {
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=MyISAM';
        }

        $this->createTable('{{%spread_url}}', [
            'id' => $this->primaryKey()->unsigned()->comment('自增id'),
            'game_id' => $this->integer(32)->unique()->defaultValue(0)->comment('游戏ID'),
            'game_url' => $this->string(500)->defaultValue('')->comment('游戏推广链接'),
        ], $tableOptions);
    }

    public function down()
    {
        $this->dropTable('{{%spread_url}}');
    }
}
